package model;

import java.util.HashSet;
import java.util.Set;

public class CartItem extends BasicItem{
	private int inventoryId;
	private Color color;
	private Figure figure;
	private Size size;
	private int count;
	private Set<Present> presents;
	public CartItem(int id, String description, double price,
			double promotionalPrice, String brandDescription, Producer producer,
			int inventoryId, Color color, Figure figure, Size size, int count) {
		super(id, description, price, promotionalPrice, brandDescription, producer);
		this.inventoryId = inventoryId;
		this.color = color;
		this.size = size;
		this.figure = figure;
		this.count = count;
		this.presents = new HashSet<Present>();
	}
	public void addPresent(Present present){
		this.presents.add(present);
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + inventoryId;
		return result;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CartItem other = (CartItem) obj;
		if (inventoryId != other.inventoryId)
			return false;
		return true;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "CartItem [inventoryId=" + inventoryId + ", color=" + color
				+ ", figure=" + figure + ", size=" + size + ", count=" + count
				+ ", toString()=" + super.toString() + "]";
	}
	

}
